package com.project.basis.base;

import android.os.Handler;
import android.os.Message;

import java.lang.ref.WeakReference;

public class BaseHandler<T> extends Handler {

    private WeakReference<T> weakReference;

    private BaseHandler() {

    }

    public BaseHandler(T object) {
        weakReference = new WeakReference<>(object);
    }

    @Override
    public void handleMessage(Message msg) {
        T object = weakReference.get();
        if (object != null) {
            handleMessage(object, msg);
        }
    }

    public void handleMessage(T object, Message msg) {

    }
}
